﻿'========================================================================
'功能:群組管理
'作者:andy
'日期: 2011/2/1
'========================================================================
Partial Class WebForm_Manage_GroupMaintain
    Inherits BasePage
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hiUID.Value = ActualUID
            hidbName.Value = dbName
            If Not ChkProgramRight(1) Then '查詢
                gvGroup.Visible = False
            End If
            If Not ChkProgramRight(2) Then '編輯
                gvGroup.Columns(0).Visible = False

            End If
            lblTitle.Text = GetLocalResourceObject("lblTitle")

          

        End If

    End Sub

    Protected Sub gvGroup_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvGroup.RowUpdating

        Dim bbl As OAMS.BBL.GroupBBL = New OAMS.BBL.GroupBBL()

        If (CType(gvGroup.Rows(e.RowIndex).FindControl("txtGroupName"), TextBox).Text.Trim = "") Then
            e.Cancel = True
            ShowMessageForAjax(gvGroup, GetLocalResourceObject("ErrGroupNameEmpty").ToString())
            Exit Sub
        End If
        Dim groupID As String = CType(gvGroup.Rows(e.RowIndex).FindControl("txtGroupID"), TextBox).Text
        ''檢查是否有同樣的群組
        If (CType(gvGroup.Rows(e.RowIndex).FindControl("txtGroupID"), TextBox).Enabled) Then
            If bbl.GroupIDIsExist(groupID, dbName) Then
                e.Cancel = True
                ShowMessageForAjax(gvGroup.Rows(e.RowIndex).FindControl("txtGroupID"), GetLocalResourceObject("ErrGroupIDExist").ToString())
            End If
        End If


    End Sub
End Class
